package com.jivesoftware.forum.model;


public class ForumThreadAdminBean
{
	/**
	 * Factory method to create a new thread. A root message must supplied when
	 * creating the thread. Therefore, the following pattern should be applied
	 * to add a new thread to a forum:
	 * <ul>
	 * <li>Create a new message, and set each of its properties such as the
	 * subject and body.
	 * <li>Create a new thread using the root message just created.
	 * <li>Set any properties on the new thread.
	 * <li>Add the thread to the forum by calling the addThread(ForumThread)
	 * method.
	 * </ul>
	 * 
	 * Note that creating the ForumThread object is only one step of the
	 * process. You must also add the thread to the forum with the
	 * addThread(ForumThread) method.
	 * 
	 * @param forum
	 *            the forum to create the thread in.
	 * @param rootMessage
	 *            the root message of the thread.
	 * @return a new ForumThread object.
	 * @throws UnauthorizedException
	 *             if does not have CREATE_THREAD permissions.
	 */
	public ForumThreadBean createThread(Authorization authorization,
			long forum, ForumMessageBean rootMessage)
			throws UnauthorizedException
	{
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Returns the thread specified by id. The method will return null if the
	 * thread is not in the forum.
	 * 
	 * @param threadID
	 *            the id of the thread to get.
	 * @return the ForumThread corresponding to <code>threadID</code>
	 * @throws ForumThreadNotFoundException
	 *             if the specified thread cannot be loaded.
	 */
	public ForumThreadBean getThread(Authorization authorization, long threadID)
			throws ForumThreadNotFoundException, UnauthorizedException
	{
		return null;
	}

	/**
	 * Deletes a thread and all of its messages. Once a thread is deleted, the
	 * thread object should no longer be used. The search index and other
	 * resources that referenced the thread and its messages will also be
	 * updated appropriately.
	 * 
	 * @param thread
	 *            the thread to delete.
	 * @throws UnauthorizedException
	 *             if does not have ADMIN permissions.
	 * @throws ForumThreadNotFoundException
	 *             if the specified thread cannot be loaded.
	 */
	public void deleteThread(Authorization authorization, long thread)
			throws UnauthorizedException, ForumThreadNotFoundException
	{

	}

	/**
	 * Moves a thread from one forum to another. For this to work, the thread
	 * must exist in the forum that this method is invoked on, and the user
	 * calling this method must have ADMIN permissions for the forum this method
	 * is invoked on and <code>newForum</code>.
	 * <p>
	 * 
	 * The main purpose of this method is to allow admins to move non-topical
	 * threads into a more appropriate forum.
	 * 
	 * @param thread
	 *            the thread to move to another forum.
	 * @param newForum
	 *            the forum to move the thread to.
	 * @throws UnauthorizedException
	 *             if does not have ADMIN permissions for the this forum and
	 *             <code>newForum</code>.
	 * @throws ForumThreadNotFoundException
	 *             if the specified thread cannot be loaded.
	 * @throws ForumNotFoundException
	 *             if the specified forum cannot be loaded.
	 */
	public void moveThread(Authorization authorization, long thread,
			long newForum) throws UnauthorizedException,
			ForumThreadNotFoundException, ForumNotFoundException
	{

	}

	/**
	 * Returns an Iterator for the most popular threads in the forum. Popular
	 * threads are defined as those that have the most new messages over a
	 * period of time (e.g. the last 24 hours). When two threads have identical
	 * numbers of new messages, newer threads will be ordered first.
	 * <p>
	 * 
	 * A number of configurable Jive properties control how the popular threads
	 * feature works:
	 * <ul>
	 * <li> <code>popularThreads.numThreads</code> -- The number of messages
	 * that will be returned in the list of popular threads. Default is 4
	 * threads.
	 * <li> <code>popularThreads.timeWindow</code> -- The number of hours to
	 * consider new messages in a thread from. Default is 24 hours, which is
	 * suitable for sites with moderate to high amounts of traffic. Sites with
	 * less traffic may wish to set the window to a number of days.
	 * </ul>
	 * 
	 * @param forum
	 * @return an array for the most popular threads ID in the forum.
	 */
	public long[] popularThreads(Authorization authorization, long forum)
			throws UnauthorizedException
	{
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Returns the number of threads in the forum based on the specified
	 * ResultFilter. This is useful for determining such things as the number of
	 * threads in a date range, etc.
	 * 
	 * @param resultFilter
	 *            a resultFilter to limit the query on.
	 * @return the number of threads in the forum based on the filter.
	 */
	public int getThreadCount(Authorization authorization, long forum,
			ResultFilter resultFilter) throws UnauthorizedException
	{
		return 0;
	}

	/**
	 * Returns a Iterator for all the threads in the forum that match the
	 * criteria specified by the ResultFilter.
	 * 
	 * @param resultFilter
	 *            a ResultFilter object to perform filtering and sorting with.
	 * @return an array for the threads ID that match the ResultFilter.
	 */
	public long[] threads(Authorization authorization, long forum,
			ResultFilter resultFilter) throws UnauthorizedException
	{
		return null;
	}

	/**
	 * Returns an extended property of the thread. Each thread can have an
	 * arbitrary number of extended properties. This allows for enhanced
	 * functionality that is not part of the base interface.
	 * 
	 * @param name
	 *            the name of the property to get.
	 * @param the
	 *            value of the property specified by name.
	 */
	public String getProperty(String name)
	{
		return null;
	}

	/**
	 * Sets an extended property of the thread. Each thread can have an
	 * arbitrary number of extended properties. This allows for enhanced
	 * functionality that is not part of the base interface.
	 * <p>
	 * 
	 * The user that created the thread (author of rootMessage), or system or
	 * forum admins can always call this method. Additionally, anyone (including
	 * anonymous users) can call this method before the thread has been added to
	 * a Forum.
	 * 
	 * @param name
	 *            the name of the property to set.
	 * @param value
	 *            the new value for the property.
	 * @throws UnauthorizedException
	 *             if not allowed to set extended properties.
	 */
	public void setProperty(Authorization authorization, String name,
			String value) throws UnauthorizedException
	{

	}

	/**
	 * Deletes an extended property. If the property specified by
	 * <code>name</code> does not exist, this method will do nothing.
	 * <p>
	 * 
	 * The user that created the thread (author of rootMessage), or system or
	 * forum admins can always call this method. Additionally, anyone (including
	 * anonymous users) can call this method before the thread has been added to
	 * a Forum.
	 * 
	 * @param name
	 *            the name of the property to delete.
	 * @throws UnauthorizedException
	 *             if not allowed to delete extended properties.
	 */
	public void deleteProperty(Authorization authorization, String name)
			throws UnauthorizedException
	{

	}

	/**
	 * Returns an Iterator for the names of the thread properties.
	 * 
	 * @return an Iterator for the names of the thread properties.
	 */
	public String[] propertyNames()
	{
		return null;
	}

}
